dojo.provide('app.i18n');
dojo.require('dojo.i18n');
(function(){
	if(dojo && dojo.i18n && dojo.i18n.getLocalization){
		function get(prop){
			var val = this[prop];
			if(val){
				var args = [].slice.call(arguments).slice(1);
				var s=[];
				i = 0;
				while(s = val.match(/{\d+}/)){
					val = val.replace(/{\d+}/,this[args[i]]||args[i]||s[0]);
					i++;
				}
			}
		    return val;
		}
		app.i18n.getLocalization = function(/*String*/packageName, /*String*/bundleName, /*String?*/locale){
			var messages = dojo.i18n.getLocalization.call(this,packageName,bundleName,locale);
			if(messages){
				var clazz = function(){};
				clazz.prototype = messages;
				clazz.prototype.get = get;
				return new clazz();
			}else{
				return messages;
			}
		}
	}
})();